/**
 * @FileName: Start.java
 * @Package: top.swimmer.demo
 * @author youshipeng
 * @created 2017/5/2 16:08
 * <p>
 * Copyright 2016 ziroom
 */
package top.swimmer.demo;

import top.swimmer.demo.entity.SentenceTrunk;
import top.swimmer.demo.nlp.QuestionType;
import top.swimmer.demo.question.MaintainQuestionElement;

import java.util.Scanner;

import static top.swimmer.demo.nlp.QuestionTemplate.getQuestionType;
import static top.swimmer.demo.nlp.SegmentUtils.getMaintainThing;

/**
 * <p></p>
 *
 * <PRE>
 * <BR>	修改记录
 * <BR>-----------------------------------------------
 * <BR>	修改日期			修改人			修改内容
 * </PRE>
 *
 * @author youshipeng
 * @since 1.0
 * @version 1.0
 */
public class Start {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String question = scanner.next();

        go(question, scanner);
    }

    public static void go(String question, Scanner scanner) {
        SentenceTrunk sentenceTrunk = new SentenceTrunk();
        sentenceTrunk.result = question;
        QuestionType questionType = getQuestionType(sentenceTrunk);

        if (questionType != QuestionType.MAINTAIN && questionType != QuestionType.MAINTAIN_SURE) {
            System.out.println("额，这个问题我还不会呀！");
            return;
        }

        MaintainQuestionElement maintainQuestionElement = new MaintainQuestionElement(getMaintainThing(question));

        if (questionType == QuestionType.MAINTAIN_SURE) {
            maintainQuestionElement.setDecision(true);
        }

        while (true) {
            if (!maintainQuestionElement.isDecision() || !maintainQuestionElement.isElementsFull()) {
                System.out.println(maintainQuestionElement.backAsk());
                String input = scanner.next();
                maintainQuestionElement.extractFocus(input);
            } else {
                break;
            }
        }

        System.out.println(maintainQuestionElement);
    }
}